<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Application - Documentation</title>

    <script src="scripts/prettify/prettify.js"></script>
    <script src="scripts/prettify/lang-css.js"></script>
    <!--[if lt IE 9]>
      <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <link type="text/css" rel="stylesheet" href="styles/ionicons.min.css">
    <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
    <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>

<input type="checkbox" id="nav-trigger" class="nav-trigger" />
<label for="nav-trigger" class="navicon-button x">
  <div class="navicon"></div>
</label>

<label for="nav-trigger" class="overlay"></label>

<nav>
    <h2><a href="index.html">Home</a></h2>
  <h3>Egg</h3>
  <ul>
    <li>
      <a href="Egg.html">Egg</a>
      <a href="Application.html">Application</a>
      <a href="Context.html">Context</a>
      <a href="Request.html">Request</a>
      <a href="Response.html">Response</a>
    </li>
  </ul>
  <h3>Classes</h3><ul><li><a href="Agent.html">Agent</a><ul class='members'><li data-type='member'><a href="Agent.html#coreLogger">coreLogger</a></li><li data-type='member'><a href="Agent.html#env">env</a></li><li data-type='member'><a href="Agent.html#httpclient">httpclient</a></li><li data-type='member'><a href="Agent.html#logger">logger</a></li><li data-type='member'><a href="Agent.html#loggers">loggers</a></li><li data-type='member'><a href="Agent.html#messenger">messenger</a></li><li data-type='member'><a href="Agent.html#proxy">proxy</a></li><li data-type='member'><a href="Agent.html#addSingleton">addSingleton()</a></li><li data-type='member'><a href="Agent.html#cluster">cluster()</a></li><li data-type='member'><a href="Agent.html#curl">curl()</a></li><li data-type='member'><a href="Agent.html#getLogger">getLogger()</a></li><li data-type='member'><a href="Agent.html#inspect">inspect()</a></li></ul></li><li><a href="AgentWorkerLoader.html">AgentWorkerLoader</a><ul class='members'><li data-type='member'><a href="AgentWorkerLoader.html#loadConfig">loadConfig()</a></li></ul></li><li><a href="AppInfo.html">AppInfo</a><ul class='members'><li data-type='member'><a href="AppInfo.html#baseDir">baseDir</a></li><li data-type='member'><a href="AppInfo.html#env">env</a></li><li data-type='member'><a href="AppInfo.html#HOME">HOME</a></li><li data-type='member'><a href="AppInfo.html#name">name</a></li><li data-type='member'><a href="AppInfo.html#pkg">pkg</a></li><li data-type='member'><a href="AppInfo.html#root">root</a></li><li data-type='member'><a href="AppInfo.html#scope">scope</a></li></ul></li><li><a href="Application.html">Application</a><ul class='members'><li data-type='member'><a href="Application.html#coreLogger">coreLogger</a></li><li data-type='member'><a href="Application.html#createAnonymousContext">createAnonymousContext</a></li><li data-type='member'><a href="Application.html#env">env</a></li><li data-type='member'><a href="Application.html#Helper">Helper</a></li><li data-type='member'><a href="Application.html#httpclient">httpclient</a></li><li data-type='member'><a href="Application.html#keys">keys</a></li><li data-type='member'><a href="Application.html#locals">locals</a></li><li data-type='member'><a href="Application.html#logger">logger</a></li><li data-type='member'><a href="Application.html#loggers">loggers</a></li><li data-type='member'><a href="Application.html#messenger">messenger</a></li><li data-type='member'><a href="Application.html#proxy">proxy</a></li><li data-type='member'><a href="Application.html#view">view</a></li><li data-type='member'><a href="Application.html#addSingleton">addSingleton()</a></li><li data-type='member'><a href="Application.html#cluster">cluster()</a></li><li data-type='member'><a href="Application.html#createContext">createContext()</a></li><li data-type='member'><a href="Application.html#curl">curl()</a></li><li data-type='member'><a href="Application.html#getLogger">getLogger()</a></li><li data-type='member'><a href="Application.html#inspect">inspect()</a></li><li data-type='member'><a href="Application.html#runInBackground">runInBackground()</a></li></ul></li><li><a href="AppWorkerLoader.html">AppWorkerLoader</a><ul class='members'><li data-type='member'><a href="AppWorkerLoader.html#load">load()</a></li><li data-type='member'><a href="AppWorkerLoader.html#loadConfig">loadConfig()</a></li></ul></li><li><a href="global.html#BaseContextClass">BaseContextClass</a><ul class='members'><li data-type='member'><a href="global.html#BaseContextClass#app">app</a></li><li data-type='member'><a href="global.html#BaseContextClass#config">config</a></li><li data-type='member'><a href="global.html#BaseContextClass#ctx">ctx</a></li><li data-type='member'><a href="global.html#BaseContextClass#service">service</a></li></ul></li><li><a href="BaseContextLogger.html">BaseContextLogger</a><ul class='members'><li data-type='member'><a href="BaseContextLogger.html#ctx">ctx</a></li><li data-type='member'><a href="BaseContextLogger.html#debug">debug</a></li><li data-type='member'><a href="BaseContextLogger.html#error">error</a></li><li data-type='member'><a href="BaseContextLogger.html#info">info</a></li><li data-type='member'><a href="BaseContextLogger.html#warn">warn</a></li></ul></li><li><a href="Config.html">Config</a><ul class='members'><li data-type='member'><a href="Config.html#baseDir">baseDir</a></li><li data-type='member'><a href="Config.html#bodyParser">bodyParser</a></li><li data-type='member'><a href="Config.html#cluster">cluster</a></li><li data-type='member'><a href="Config.html#confusedConfigurations">confusedConfigurations</a></li><li data-type='member'><a href="Config.html#development">development</a></li><li data-type='member'><a href="Config.html#dump">dump</a></li><li data-type='member'><a href="Config.html#env">env</a></li><li data-type='member'><a href="Config.html#HOME">HOME</a></li><li data-type='member'><a href="Config.html#hostHeaders">hostHeaders</a></li><li data-type='member'><a href="Config.html#httpclient">httpclient</a></li><li data-type='member'><a href="Config.html#i18n">i18n</a></li><li data-type='member'><a href="Config.html#ipHeaders">ipHeaders</a></li><li data-type='member'><a href="Config.html#jsonp">jsonp</a></li><li data-type='member'><a href="Config.html#keys">keys</a></li><li data-type='member'><a href="Config.html#logger">logger</a></li><li data-type='member'><a href="Config.html#logrotator">logrotator</a></li><li data-type='member'><a href="Config.html#meta">meta</a></li><li data-type='member'><a href="Config.html#middleware">middleware</a></li><li data-type='member'><a href="Config.html#multipart">multipart</a></li><li data-type='member'><a href="Config.html#name">name</a></li><li data-type='member'><a href="Config.html#notfound">notfound</a></li><li data-type='member'><a href="Config.html#onClientError">onClientError</a></li><li data-type='member'><a href="Config.html#pkg">pkg</a></li><li data-type='member'><a href="Config.html#protocolHeaders">protocolHeaders</a></li><li data-type='member'><a href="Config.html#proxy">proxy</a></li><li data-type='member'><a href="Config.html#rundir">rundir</a></li><li data-type='member'><a href="Config.html#security">security</a></li><li data-type='member'><a href="Config.html#siteFile">siteFile</a></li><li data-type='member'><a href="Config.html#static">static</a></li><li data-type='member'><a href="Config.html#view">view</a></li><li data-type='member'><a href="Config.html#watcher">watcher</a></li><li data-type='member'><a href="Config.html#.workerStartTimeout">workerStartTimeout</a></li></ul></li><li><a href="Context.html">Context</a><ul class='members'><li data-type='member'><a href="Context.html#accept">accept</a></li><li data-type='member'><a href="Context.html#acceptJSON">acceptJSON</a></li><li data-type='member'><a href="Context.html#coreLogger">coreLogger</a></li><li data-type='member'><a href="Context.html#helper">helper</a></li><li data-type='member'><a href="Context.html#ip">ip</a></li><li data-type='member'><a href="Context.html#locale">locale</a></li><li data-type='member'><a href="Context.html#locals">locals</a></li><li data-type='member'><a href="Context.html#logger">logger</a></li><li data-type='member'><a href="Context.html#params">params</a></li><li data-type='member'><a href="Context.html#queries">queries</a></li><li data-type='member'><a href="Context.html#realStatus">realStatus</a></li><li data-type='member'><a href="Context.html#router">router</a></li><li data-type='member'><a href="Context.html#starttime">starttime</a></li><li data-type='member'><a href="Context.html#view">view</a></li><li data-type='member'><a href="Context.html#__">__()</a></li><li data-type='member'><a href="Context.html#curl">curl()</a></li><li data-type='member'><a href="Context.html#getFileStream">getFileStream()</a></li><li data-type='member'><a href="Context.html#gettext">gettext()</a></li><li data-type='member'><a href="Context.html#multipart">multipart()</a></li><li data-type='member'><a href="Context.html#redirect">redirect()</a></li></ul></li><li><a href="ContextLoader.html">ContextLoader</a><ul class='members'><li data-type='member'><a href="ContextLoader.html#load">load()</a></li><li data-type='member'><a href="ContextLoader.html#parse">parse()</a></li></ul></li><li><a href="global.html#Controller">Controller</a><ul class='members'><li data-type='member'><a href="global.html#Controller#app">app</a></li><li data-type='member'><a href="global.html#Controller#config">config</a></li><li data-type='member'><a href="global.html#Controller#ctx">ctx</a></li><li data-type='member'><a href="global.html#Controller#service">service</a></li></ul></li><li><a href="EggApplication.html">EggApplication</a><ul class='members'><li data-type='member'><a href="EggApplication.html#BaseContextClass">BaseContextClass</a></li><li data-type='member'><a href="EggApplication.html#baseDir">baseDir</a></li><li data-type='member'><a href="EggApplication.html#config">config</a></li><li data-type='member'><a href="EggApplication.html#Controller">Controller</a></li><li data-type='member'><a href="EggApplication.html#coreLogger">coreLogger</a></li><li data-type='member'><a href="EggApplication.html#deprecate">deprecate</a></li><li data-type='member'><a href="EggApplication.html#env">env</a></li><li data-type='member'><a href="EggApplication.html#httpclient">httpclient</a></li><li data-type='member'><a href="EggApplication.html#loader">loader</a></li><li data-type='member'><a href="EggApplication.html#logger">logger</a></li><li data-type='member'><a href="EggApplication.html#loggers">loggers</a></li><li data-type='member'><a href="EggApplication.html#messenger">messenger</a></li><li data-type='member'><a href="EggApplication.html#name">name</a></li><li data-type='member'><a href="EggApplication.html#plugins">plugins</a></li><li data-type='member'><a href="EggApplication.html#proxy">proxy</a></li><li data-type='member'><a href="EggApplication.html#router">router</a></li><li data-type='member'><a href="EggApplication.html#Service">Service</a></li><li data-type='member'><a href="EggApplication.html#type">type</a></li><li data-type='member'><a href="EggApplication.html#addSingleton">addSingleton()</a></li><li data-type='member'><a href="EggApplication.html#beforeClose">beforeClose()</a></li><li data-type='member'><a href="EggApplication.html#beforeStart">beforeStart()</a></li><li data-type='member'><a href="EggApplication.html#close">close()</a></li><li data-type='member'><a href="EggApplication.html#cluster">cluster()</a></li><li data-type='member'><a href="EggApplication.html#curl">curl()</a></li><li data-type='member'><a href="EggApplication.html#getLogger">getLogger()</a></li><li data-type='member'><a href="EggApplication.html#inspect">inspect()</a></li><li data-type='member'><a href="EggApplication.html#toAsyncFunction">toAsyncFunction()</a></li><li data-type='member'><a href="EggApplication.html#toPromise">toPromise()</a></li><li data-type='member'><a href="EggApplication.html#url">url()</a></li><li data-type='member'><a href="EggApplication.html#use">use()</a></li></ul></li><li><a href="EggCore.html">EggCore</a><ul class='members'><li data-type='member'><a href="EggCore.html#BaseContextClass">BaseContextClass</a></li><li data-type='member'><a href="EggCore.html#baseDir">baseDir</a></li><li data-type='member'><a href="EggCore.html#config">config</a></li><li data-type='member'><a href="EggCore.html#Controller">Controller</a></li><li data-type='member'><a href="EggCore.html#deprecate">deprecate</a></li><li data-type='member'><a href="EggCore.html#loader">loader</a></li><li data-type='member'><a href="EggCore.html#name">name</a></li><li data-type='member'><a href="EggCore.html#plugins">plugins</a></li><li data-type='member'><a href="EggCore.html#router">router</a></li><li data-type='member'><a href="EggCore.html#Service">Service</a></li><li data-type='member'><a href="EggCore.html#type">type</a></li><li data-type='member'><a href="EggCore.html#beforeClose">beforeClose()</a></li><li data-type='member'><a href="EggCore.html#beforeStart">beforeStart()</a></li><li data-type='member'><a href="EggCore.html#close">close()</a></li><li data-type='member'><a href="EggCore.html#toAsyncFunction">toAsyncFunction()</a></li><li data-type='member'><a href="EggCore.html#toPromise">toPromise()</a></li><li data-type='member'><a href="EggCore.html#url">url()</a></li><li data-type='member'><a href="EggCore.html#use">use()</a></li></ul></li><li><a href="EggLoader.html">EggLoader</a><ul class='members'><li data-type='member'><a href="EggLoader.html#appInfo">appInfo</a></li><li data-type='member'><a href="EggLoader.html#ContextLoader">ContextLoader</a></li><li data-type='member'><a href="EggLoader.html#eggPaths">eggPaths</a></li><li data-type='member'><a href="EggLoader.html#FileLoader">FileLoader</a></li><li data-type='member'><a href="EggLoader.html#pkg">pkg</a></li><li data-type='member'><a href="EggLoader.html#plugins">plugins</a></li><li data-type='member'><a href="EggLoader.html#serverEnv">serverEnv</a></li><li data-type='member'><a href="EggLoader.html#serverScope">serverScope</a></li><li data-type='member'><a href="EggLoader.html#getAppInfo">getAppInfo()</a></li><li data-type='member'><a href="EggLoader.html#getHomedir">getHomedir()</a></li><li data-type='member'><a href="EggLoader.html#getLoadUnits">getLoadUnits()</a></li><li data-type='member'><a href="EggLoader.html#loadAgentExtend">loadAgentExtend()</a></li><li data-type='member'><a href="EggLoader.html#loadApplicationExtend">loadApplicationExtend()</a></li><li data-type='member'><a href="EggLoader.html#loadConfig">loadConfig()</a></li><li data-type='member'><a href="EggLoader.html#loadContextExtend">loadContextExtend()</a></li><li data-type='member'><a href="EggLoader.html#loadFile">loadFile()</a></li><li data-type='member'><a href="EggLoader.html#loadHelperExtend">loadHelperExtend()</a></li><li data-type='member'><a href="EggLoader.html#loadMiddleware">loadMiddleware()</a></li><li data-type='member'><a href="EggLoader.html#loadPlugin">loadPlugin()</a></li><li data-type='member'><a href="EggLoader.html#loadRequestExtend">loadRequestExtend()</a></li><li data-type='member'><a href="EggLoader.html#loadResponseExtend">loadResponseExtend()</a></li><li data-type='member'><a href="EggLoader.html#loadRouter">loadRouter()</a></li><li data-type='member'><a href="EggLoader.html#loadService">loadService()</a></li><li data-type='member'><a href="EggLoader.html#loadToApp">loadToApp()</a></li><li data-type='member'><a href="EggLoader.html#loadToContext">loadToContext()</a></li></ul></li><li><a href="FileLoader.html">FileLoader</a><ul class='members'><li data-type='member'><a href="FileLoader.html#load">load()</a></li><li data-type='member'><a href="FileLoader.html#parse">parse()</a></li></ul></li><li><a href="Helper.html">Helper</a><ul class='members'><li data-type='member'><a href="Helper.html#pathFor">pathFor()</a></li><li data-type='member'><a href="Helper.html#urlFor">urlFor()</a></li></ul></li><li><a href="I18n.html">I18n</a></li><li><a href="Messenger.html">Messenger</a><ul class='members'><li data-type='member'><a href="Messenger.html#broadcast">broadcast()</a></li><li data-type='member'><a href="Messenger.html#send">send()</a></li><li data-type='member'><a href="Messenger.html#sendRandom">sendRandom()</a></li><li data-type='member'><a href="Messenger.html#sendTo">sendTo()</a></li><li data-type='member'><a href="Messenger.html#sendToAgent">sendToAgent()</a></li><li data-type='member'><a href="Messenger.html#sendToApp">sendToApp()</a></li></ul></li><li><a href="Request.html">Request</a><ul class='members'><li data-type='member'><a href="Request.html#acceptJSON">acceptJSON</a></li><li data-type='member'><a href="Request.html#header">header</a></li><li data-type='member'><a href="Request.html#headers">headers</a></li><li data-type='member'><a href="Request.html#host">host</a></li><li data-type='member'><a href="Request.html#ip">ip</a></li><li data-type='member'><a href="Request.html#ips">ips</a></li><li data-type='member'><a href="Request.html#method">method</a></li><li data-type='member'><a href="Request.html#originalUrl">originalUrl</a></li><li data-type='member'><a href="Request.html#path">path</a></li><li data-type='member'><a href="Request.html#protocol">protocol</a></li><li data-type='member'><a href="Request.html#queries">queries</a></li><li data-type='member'><a href="Request.html#query">query</a></li><li data-type='member'><a href="Request.html#querystring">querystring</a></li><li data-type='member'><a href="Request.html#url">url</a></li><li data-type='member'><a href="Request.html#query">query()</a></li></ul></li><li><a href="Response.html">Response</a><ul class='members'><li data-type='member'><a href="Response.html#realStatus">realStatus</a></li><li data-type='member'><a href="Response.html#type">type</a></li><li data-type='member'><a href="Response.html#type">type</a></li></ul></li><li><a href="Router.html">Router</a><ul class='members'><li data-type='member'><a href="Router.html#register">register()</a></li><li data-type='member'><a href="Router.html#resources">resources()</a></li><li data-type='member'><a href="Router.html#url">url()</a></li></ul></li><li><a href="global.html#Service">Service</a><ul class='members'><li data-type='member'><a href="global.html#Service#app">app</a></li><li data-type='member'><a href="global.html#Service#config">config</a></li><li data-type='member'><a href="global.html#Service#ctx">ctx</a></li><li data-type='member'><a href="global.html#Service#service">service</a></li></ul></li></ul><h3>Namespaces</h3><ul><li><a href="Egg.html">Egg</a><ul class='members'><li data-type='member'><a href="Egg.html#Agent">Agent</a></li><li data-type='member'><a href="Egg.html#AgentWorkerLoader">AgentWorkerLoader</a></li><li data-type='member'><a href="Egg.html#Application">Application</a></li><li data-type='member'><a href="Egg.html#AppWorkerLoader">AppWorkerLoader</a></li><li data-type='member'><a href="Egg.html#BaseContextClass">BaseContextClass</a></li><li data-type='member'><a href="Egg.html#Controller">Controller</a></li><li data-type='member'><a href="Egg.html#Service">Service</a></li><li data-type='member'><a href="Egg.html#Subscription">Subscription</a></li></ul></li></ul>
</nav>

<div id="main">
    
    <h1 class="page-title">Application</h1>
    

    




<section>

<header>
    
        <h2>
        Application
        </h2>
        
            <div class="class-description"><p>Singleton instance in App Worker, extend <a href="EggApplication.html">EggApplication</a></p></div>
        
    
</header>

<article>
    <div class="container-overview">
    
        

    
    <h2>Constructor</h2>
    

    <h4 class="name" id="Application"><span class="type-signature"></span>new Application<span class="signature">(options)</span><span class="type-signature"></span></h4>

    











    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name">
                  
                  <code>options</code>
                  
                  
                </td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>


            
            </td>

            

            <td class="description last"><p>see <a href="EggApplication.html">EggApplication</a></p></td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="lib_application.js.html">lib/application.js</a>, <a href="lib_application.js.html#line51">line 51</a>
    </li></ul></dd>
    

    

    

    
</dl>














    
    </div>

    
        <h3 class="subsection-title">Extends</h3>

        


    <ul>
        <li><a href="EggApplication.html">EggApplication</a></li>
    </ul>


    

    

    

     

    

    
        <h3 class="subsection-title">Members</h3>

        
            
<h4 class="name" id="coreLogger"><span class="type-signature"></span>coreLogger<span class="type-signature"> :Logger</span></h4>




<div class="description">
    <p>core logger for framework and plugins, log file is <code>$HOME/logs/{appname}/egg-web</code></p>
</div>





<dl class="details">

    

    
    <dt class="tag-since">Since:</dt>
    <dd class="tag-since"><ul class="dummy"><li>1.0.0</li></ul></dd>
    

    
    <dt class="inherited-from">Inherited From:</dt>
    <dd class="inherited-from"><ul class="dummy"><li>
        <a href="EggApplication.html#coreLogger">EggApplication#coreLogger</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="lib_egg.js.html">lib/egg.js</a>, <a href="lib_egg.js.html#line303">line 303</a>
    </li></ul></dd>
    

    

    

    
</dl>






        
            
<h4 class="name" id="createAnonymousContext"><span class="type-signature"></span>createAnonymousContext<span class="type-signature"> :String</span></h4>




<div class="description">
    <p>Create an anonymous context, the context isn't request level, so the request is mocked.
then you can use context level API like <code>ctx.service</code></p>
</div>





<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="lib_application.js.html">lib/application.js</a>, <a href="lib_application.js.html#line256">line 256</a>
    </li></ul></dd>
    

    

    

    
</dl>






        
            
<h4 class="name" id="env"><span class="type-signature"></span>env<span class="type-signature"></span></h4>




<div class="description">
    <p>app.env delegate app.config.env</p>
</div>





<dl class="details">

    

    

    
    <dt class="inherited-from">Inherited From:</dt>
    <dd class="inherited-from"><ul class="dummy"><li>
        <a href="EggApplication.html#env">EggApplication#env</a>
    </li></ul></dd>
    

    

    

    

    

    
        <dt class="important tag-deprecated">Deprecated:</dt><dd class="yes-def tag-deprecated"><ul class="dummy"><li>Yes</li></ul></dd>
    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="lib_egg.js.html">lib/egg.js</a>, <a href="lib_egg.js.html#line384">line 384</a>
    </li></ul></dd>
    

    

    

    
</dl>






        
            
<h4 class="name" id="Helper"><span class="type-signature"></span>Helper<span class="type-signature"> :<a href="Helper.html">Helper</a></span></h4>




<div class="description">
    <p>reference to <a href="Helper.html">Helper</a></p>
</div>





<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="lib_application.js.html">lib/application.js</a>, <a href="lib_application.js.html#line326">line 326</a>
    </li></ul></dd>
    

    

    

    
</dl>






        
            
<h4 class="name" id="httpclient"><span class="type-signature"></span>httpclient<span class="type-signature"> :HttpClient</span></h4>




<div class="description">
    <p>HttpClient instance</p>
</div>





<dl class="details">

    

    

    
    <dt class="inherited-from">Inherited From:</dt>
    <dd class="inherited-from"><ul class="dummy"><li>
        <a href="EggApplication.html#httpclient">EggApplication#httpclient</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="lib_egg.js.html">lib/egg.js</a>, <a href="lib_egg.js.html#line256">line 256</a>
    </li></ul></dd>
    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="https://github.com/node-modules/urllib">https://github.com/node-modules/urllib</a></li>
        </ul>
    </dd>
    

    
</dl>






        
            
<h4 class="name" id="keys"><span class="type-signature"></span>keys<span class="type-signature"> :String</span></h4>




<div class="description">
    <p>secret key for Application</p>
</div>





<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="lib_application.js.html">lib/application.js</a>, <a href="lib_application.js.html#line306">line 306</a>
    </li></ul></dd>
    

    

    

    
</dl>






        
            
<h4 class="name" id="locals"><span class="type-signature"></span>locals<span class="type-signature"> :Object</span></h4>




<div class="description">
    <p>global locals for view</p>
</div>





<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="lib_application.js.html">lib/application.js</a>, <a href="lib_application.js.html#line172">line 172</a>
    </li></ul></dd>
    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="Context.html#locals">Context#locals</a></li>
        </ul>
    </dd>
    

    
</dl>






        
            
<h4 class="name" id="logger"><span class="type-signature"></span>logger<span class="type-signature"> :Logger</span></h4>




<div class="description">
    <p>application logger, log file is <code>$HOME/logs/{appname}/{appname}-web</code></p>
</div>





<dl class="details">

    

    
    <dt class="tag-since">Since:</dt>
    <dd class="tag-since"><ul class="dummy"><li>1.0.0</li></ul></dd>
    

    
    <dt class="inherited-from">Inherited From:</dt>
    <dd class="inherited-from"><ul class="dummy"><li>
        <a href="EggApplication.html#logger">EggApplication#logger</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="lib_egg.js.html">lib/egg.js</a>, <a href="lib_egg.js.html#line294">line 294</a>
    </li></ul></dd>
    

    

    

    
</dl>






        
            
<h4 class="name" id="loggers"><span class="type-signature"></span>loggers<span class="type-signature"> :Object</span></h4>




<div class="description">
    <p>All loggers contain logger, coreLogger and customLogger</p>
</div>





<dl class="details">

    

    
    <dt class="tag-since">Since:</dt>
    <dd class="tag-since"><ul class="dummy"><li>1.0.0</li></ul></dd>
    

    
    <dt class="inherited-from">Inherited From:</dt>
    <dd class="inherited-from"><ul class="dummy"><li>
        <a href="EggApplication.html#loggers">EggApplication#loggers</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="lib_egg.js.html">lib/egg.js</a>, <a href="lib_egg.js.html#line272">line 272</a>
    </li></ul></dd>
    

    

    

    
</dl>






        
            
<h4 class="name" id="messenger"><span class="type-signature"></span>messenger<span class="type-signature"> :<a href="Messenger.html">Messenger</a></span></h4>




<div class="description">
    <p>messenger instance</p>
</div>





<dl class="details">

    

    
    <dt class="tag-since">Since:</dt>
    <dd class="tag-since"><ul class="dummy"><li>1.0.0</li></ul></dd>
    

    
    <dt class="inherited-from">Inherited From:</dt>
    <dd class="inherited-from"><ul class="dummy"><li>
        <a href="EggApplication.html#messenger">EggApplication#messenger</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="lib_egg.js.html">lib/egg.js</a>, <a href="lib_egg.js.html#line57">line 57</a>
    </li></ul></dd>
    

    

    

    
</dl>






        
            
<h4 class="name" id="proxy"><span class="type-signature"></span>proxy<span class="type-signature"></span></h4>




<div class="description">
    <p>app.proxy delegate app.config.proxy</p>
</div>





<dl class="details">

    

    

    
    <dt class="inherited-from">Inherited From:</dt>
    <dd class="inherited-from"><ul class="dummy"><li>
        <a href="EggApplication.html#proxy">EggApplication#proxy</a>
    </li></ul></dd>
    

    

    

    

    

    
        <dt class="important tag-deprecated">Deprecated:</dt><dd class="yes-def tag-deprecated"><ul class="dummy"><li>Yes</li></ul></dd>
    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="lib_egg.js.html">lib/egg.js</a>, <a href="lib_egg.js.html#line395">line 395</a>
    </li></ul></dd>
    

    

    

    
</dl>






        
            
<h4 class="name" id="view"><span class="type-signature"></span>view<span class="type-signature"> :ViewManager</span></h4>




<div class="description">
    <p>Retrieve ViewManager instance</p>
</div>





<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="node_modules__egg-view@2.1.0@egg-view_app_extend_application.js.html">node_modules/_egg-view@2.1.0@egg-view/app/extend/application.js</a>, <a href="node_modules__egg-view@2.1.0@egg-view_app_extend_application.js.html#line7">line 7</a>
    </li></ul></dd>
    

    

    

    
</dl>






        
    

    
        <h3 class="subsection-title">Methods</h3>

        
            

    

    <h4 class="name" id="addSingleton"><span class="type-signature"></span>addSingleton<span class="signature">(name, create)</span><span class="type-signature"></span></h4>

    



<div class="description">
    <p>create a singleton instance</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name">
                  
                  <code>name</code>
                  
                  
                </td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            

            <td class="description last"><p>unique name for singleton</p></td>
        </tr>

    

        <tr>
            
                <td class="name">
                  
                  <code>create</code>
                  
                  
                </td>
            

            <td class="type">
            
                
<span class="param-type">function</span>
|

<span class="param-type">AsyncFunction</span>


            
            </td>

            

            <td class="description last"><p>method will be invoked when singleton instance create</p></td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    
    <dt class="inherited-from">Inherited From:</dt>
    <dd class="inherited-from"><ul class="dummy"><li>
        <a href="EggApplication.html#addSingleton">EggApplication#addSingleton</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="lib_egg.js.html">lib/egg.js</a>, <a href="lib_egg.js.html#line407">line 407</a>
    </li></ul></dd>
    

    

    

    
</dl>














        
            

    

    <h4 class="name" id="cluster"><span class="type-signature"></span>cluster<span class="signature">(clientClass, options<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {ClientWrapper}</span></h4>

    



<div class="description">
    <p>almost the same as Agent.cluster API, the only different is that this method create Follower.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name">
                  
                  <code>clientClass</code>
                  
                  
                </td>
            

            <td class="type">
            
                
<span class="param-type">function</span>


            
            </td>

            

            <td class="description last"><p>client class function</p></td>
        </tr>

    

        <tr>
            
                <td class="name">
                  
                    [
                  
                  <code>options</code>
                  
                  
                    ]
                  
                </td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>


            
            </td>

            

            <td class="description last"><ul>
<li>{Boolean} [autoGenerate] - whether generate delegate rule automatically, default is true<ul>
<li>{Function} [formatKey] - a method to tranform the subscription info into a string，default is JSON.stringify</li>
<li>{Object} [transcode|JSON.stringify/parse]<ul>
<li>{Function} encode - custom serialize method</li>
<li>{Function} decode - custom deserialize method</li>
</ul>
</li>
<li>{Boolean} [isBroadcast] - whether broadcast subscrption result to all followers or just one, default is true</li>
<li>{Number} [responseTimeout] - response timeout, default is 3 seconds</li>
<li>{Number} [maxWaitTime|30000] - leader startup max time, default is 30 seconds</li>
</ul>
</li>
</ul></td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    
    <dt class="inherited-from">Inherited From:</dt>
    <dd class="inherited-from"><ul class="dummy"><li>
        <a href="EggApplication.html#cluster">EggApplication#cluster</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="lib_egg.js.html">lib/egg.js</a>, <a href="lib_egg.js.html#line97">line 97</a>
    </li></ul></dd>
    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="https://github.com/node-modules/cluster-client">https://github.com/node-modules/cluster-client</a></li>
        </ul>
    </dd>
    

    
</dl>














        
            

    

    <h4 class="name" id="createContext"><span class="type-signature"></span>createContext<span class="signature">(req, res)</span><span class="type-signature"> &rarr; {<a href="Context.html">Context</a>}</span></h4>

    



<div class="description">
    <p>Create egg context</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name">
                  
                  <code>req</code>
                  
                  
                </td>
            

            <td class="type">
            
                
<span class="param-type">Req</span>


            
            </td>

            

            <td class="description last"><p>node native Request object</p></td>
        </tr>

    

        <tr>
            
                <td class="name">
                  
                  <code>res</code>
                  
                  
                </td>
            

            <td class="type">
            
                
<span class="param-type">Res</span>


            
            </td>

            

            <td class="description last"><p>node native Response object</p></td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="lib_application.js.html">lib/application.js</a>, <a href="lib_application.js.html#line192">line 192</a>
    </li></ul></dd>
    

    

    

    
</dl>














        
            

    

    <h4 class="name" id="curl"><span class="type-signature"></span>curl<span class="signature">(url, opts)</span><span class="type-signature"> &rarr; {Object}</span></h4>

    



<div class="description">
    <p>http request helper base on httpclient, it will auto save httpclient log.
Keep the same api with <code>httpclient.request(url, args)</code>.</p>
<p>See https://github.com/node-modules/urllib#api-doc for more details.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name">
                  
                  <code>url</code>
                  
                  
                </td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            

            <td class="description last"><p>request url address.</p></td>
        </tr>

    

        <tr>
            
                <td class="name">
                  
                  <code>opts</code>
                  
                  
                </td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>


            
            </td>

            

            <td class="description last"><ul>
<li>method {String} - Request method, defaults to GET. Could be GET, POST, DELETE or PUT. Alias 'type'.</li>
<li>data {Object} - Data to be sent. Will be stringify automatically.</li>
<li>dataType {String} - String - Type of response data. Could be <code>text</code> or <code>json</code>.
If it's <code>text</code>, the callbacked data would be a String.
If it's <code>json</code>, the data of callback would be a parsed JSON Object.
Default callbacked data would be a Buffer.</li>
<li>headers {Object} - Request headers.</li>
<li>timeout {Number} - Request timeout in milliseconds. Defaults to exports.TIMEOUT.
Include remote server connecting timeout and response timeout.
When timeout happen, will return ConnectionTimeout or ResponseTimeout.</li>
<li>auth {String} - <code>username:password</code> used in HTTP Basic Authorization.</li>
<li>followRedirect {Boolean} - follow HTTP 3xx responses as redirects. defaults to false.</li>
<li>gzip {Boolean} - let you get the res object when request connected, default false. alias customResponse</li>
<li>nestedQuerystring {Boolean} - urllib default use querystring to stringify form data which don't
support nested object, will use qs instead of querystring to support nested object by set this option to true.</li>
<li>more options see https://<a href="http://www.npmjs.com/package/urllib">www.npmjs.com/package/urllib</a></li>
</ul></td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    
    <dt class="inherited-from">Inherited From:</dt>
    <dd class="inherited-from"><ul class="dummy"><li>
        <a href="EggApplication.html#curl">EggApplication#curl</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="lib_egg.js.html">lib/egg.js</a>, <a href="lib_egg.js.html#line247">line 247</a>
    </li></ul></dd>
    

    

    

    
</dl>













    <h5>Example</h5>
    
    <pre class="prettyprint"><code>```js
const result = await app.curl('http://example.com/foo.json', {
  method: 'GET',
  dataType: 'json',
});
console.log(result.status, result.headers, result.data);
```</code></pre>



        
            

    

    <h4 class="name" id="getLogger"><span class="type-signature"></span>getLogger<span class="signature">(name)</span><span class="type-signature"> &rarr; {Logger}</span></h4>

    



<div class="description">
    <p>Get logger by name, it's equal to app.loggers['name'],
but you can extend it with your own logical.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name">
                  
                  <code>name</code>
                  
                  
                </td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            

            <td class="description last"><p>logger name</p></td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    
    <dt class="inherited-from">Inherited From:</dt>
    <dd class="inherited-from"><ul class="dummy"><li>
        <a href="EggApplication.html#getLogger">EggApplication#getLogger</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="lib_egg.js.html">lib/egg.js</a>, <a href="lib_egg.js.html#line285">line 285</a>
    </li></ul></dd>
    

    

    

    
</dl>














        
            

    

    <h4 class="name" id="inspect"><span class="type-signature"></span>inspect<span class="signature">()</span><span class="type-signature"> &rarr; {Object}</span></h4>

    



<div class="description">
    <p>print the infomation when console.log(app)</p>
</div>













<dl class="details">

    

    
    <dt class="tag-since">Since:</dt>
    <dd class="tag-since"><ul class="dummy"><li>1.0.0</li></ul></dd>
    

    
    <dt class="inherited-from">Inherited From:</dt>
    <dd class="inherited-from"><ul class="dummy"><li>
        <a href="EggApplication.html#inspect">EggApplication#inspect</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="lib_egg.js.html">lib/egg.js</a>, <a href="lib_egg.js.html#line162">line 162</a>
    </li></ul></dd>
    

    

    

    
</dl>













    <h5>Example</h5>
    
    <pre class="prettyprint"><code>```js
console.log(app);
=>
{
  name: 'mockapp',
  env: 'test',
  subdomainOffset: 2,
  config: '&lt;egg config>',
  controller: '&lt;egg controller>',
  service: '&lt;egg service>',
  middlewares: '&lt;egg middlewares>',
  urllib: '&lt;egg urllib>',
  loggers: '&lt;egg loggers>'
}
```</code></pre>



        
            

    

    <h4 class="name" id="runInBackground"><span class="type-signature"></span>runInBackground<span class="signature">(scope)</span><span class="type-signature"></span></h4>

    



<div class="description">
    <p>Run async function in the background</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name">
                  
                  <code>scope</code>
                  
                  
                </td>
            

            <td class="type">
            
                
<span class="param-type">function</span>


            
            </td>

            

            <td class="description last"><p>the first args is an anonymous ctx</p></td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="lib_application.js.html">lib/application.js</a>, <a href="lib_application.js.html#line300">line 300</a>
    </li></ul></dd>
    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li>Context#runInBackground</li>
        </ul>
    </dd>
    

    
</dl>














        
    

    

    
</article>

</section>




</div>

<br class="clear">

<footer>
    Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Jun 07 2018 08:57:05 GMT+0000 (UTC) using the Minami theme.
</footer>

<script>prettyPrint();</script>
<script src="scripts/linenumber.js"></script>
</body>
</html>